package logic

import (
	"context"
	"jdmall_svc/models/mysql"

	"jdmall_svc/internal/svc"
	"jdmall_svc/jdmall"

	"github.com/zeromicro/go-zero/core/logx"
)

type StatusAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewStatusAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatusAddLogic {
	return &StatusAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 审核状态
func (l *StatusAddLogic) StatusAdd(in *jdmall.StatusAddRequest) (*jdmall.StatusAddResponse, error) {
	// todo: add your logic here and delete this line

	status := mysql.Status{
		ShopId: int(in.ShopId),
		Status: int(in.Status),
	}

	mysql.DB.Debug().Create(&status)

	return &jdmall.StatusAddResponse{
		Id: int64(status.ID),
	}, nil
}
